{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,selectzone.js,colorselector.js"}
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />

{if $warning}
<ul style="padding:0; margin: 0; list-style-type:none; color: #CC0000;">
  <li style="border: 1px solid #CC0000; background: #FFFFCC; padding: 10px; margin-bottom: 5px;" >{$warning}</li>
</ul>
{/if}

<!-- start comparison form -->
<div class="tab-div">
    <!-- tab bar -->
    <div id="tabbar-div">
      <p>
        <span class="tab-front" id="general-tab">选择对比产品</span>
        <span class="tab-back" id="detail-tab">编辑对比信息</span>
      </p>
    </div>

    <!-- tab body -->
    <div id="tabbody-div">
      <form enctype="multipart/form-data" action="comparison.php" method="post" name="theForm" >
        <!-- 产品对比 -->
        <input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
        <!-- 选择对比产品 -->
        <table width="90%" id="general-table" align="center">
          <tr>
            <td class="label">产品对比标题：</td>
            <td>
                <input type="text" name="comparison_name" value="{$comparison.comparison_name|escape}" style="float:left" size="30" />
            </td>
          </tr>


          <tr>
            <td class="label">
                <a href="javascript:showNotice('comparisonA');" title="{$lang.form_notice}">
                    <img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
                </a> 本店产品A：
            </td>
            <td>
                <select name="a_brand_id" onchange="selectA(this)">
                    <option value="">请选择...</option>
                    {foreach from=$a_brand item=a_val}
                        <option value="{$a_val.brand_id}" {if $a_val.brand_id eq $comparison.a_brand_id}selected{/if}>{$a_val.brand_name}</option>
                    {/foreach}
                </select>
                <select name="a_id" id="a_id">
                    <option value="">请选择...</option>
                    {if $my_goods neq null}
                        {foreach from=$my_goods item=val}
                        <option value="{$val.goods_id}" {if $val.goods_id eq $comparison.a_id}selected{/if}>{$val.goods_name}
                    {$comparison.a_id}</option>
                        {/foreach}
                    {/if}

                </select>
                <br />
                <span class="notice-span" id="comparisonA" {if $help_open}style="display:block" {else} style="display:none" {/if} >
                    从本店品牌中选择进行对比的产品A
                </span>
            </td>
          </tr>


          <tr>
              <td class="label">
                 <a href="javascript:showNotice('comparisonB');" title="{$lang.form_notice}">
                    <img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
                 </a> 对比产品B：
              </td>
              <td>
                  <select name="b_brand_id"  onchange="selectB(this)">
                      <option value="">请选择...</option>
                      {foreach from=$b_brand item=b_val}
                           <option value="{$b_val.brand_id}" {if $b_val.brand_id eq $comparison.b_brand_id}selected{/if}>{$b_val.brand_name}</option>
                      {/foreach}
                  </select>
                  <select name="b_id" id="b_id">
                      <option value="">请选择...</option>
                      {if $other_goods neq null}
                          {foreach from=$other_goods item=val}
                          <option value="{$val.goods_id}" {if $val.goods_id eq $comparison.b_id}selected{/if}>{$val.goods_name}</option>
                          {/foreach}
                      {/if}
                  </select>
                  <br />
                  <span class="notice-span" id="comparisonB" {if $help_open}style="display:block" {else} style="display:none" {/if} >
                        从对比品牌中选择被对比的产品B
                  </span>
              </td>
          </tr>
        </table>

        <!-- 编辑对比信息 -->
        <table width="90%" id="detail-table" style="display:none">
          <tr>
            <td>{$FCKeditor}</td>
          </tr>
        </table>

        <div class="button-div">
          <input type="hidden" name="id" value="{$comparison.comparison_id}" />
          <input type="submit" value="{$lang.button_submit}" class="button" />
          <input type="reset" value="{$lang.button_reset}" class="button" />
        </div>
        <input type="hidden" name="act" value="{$form_action}" />
      </form>
    </div>
</div>
<!-- end comparison form -->
{insert_scripts files="validator.js,tab.js"}

<script language="JavaScript">

  {literal}
  onload = function()
  {
      // 开始检查订单
      startCheckOrder();
      document.forms['theForm'].reset();
  }

  function selectA(obj){
      var opt =obj.value;

      res = Ajax.call('comparison.php', "act=brand_change&a_brand_id="+opt,null, "GET", "HTML", false);

      if(res){
          document.getElementById("a_id").style.display='';
          document.getElementById("a_id").innerHTML = res;
      }else{
          document.getElementById("a_id").style.display='none';
      }
  }
  function selectB(obj){
      var opt =obj.value;

      res = Ajax.call('comparison.php', "act=brand_change&b_brand_id="+opt,null, "GET", "HTML", false);

      if(res){
          document.getElementById("b_id").style.display='';
          document.getElementById("b_id").innerHTML = res;
      }else{
          document.getElementById("b_id").style.display='none';
      }
  }

  {/literal}
</script>
{include file="pagefooter.htm"}
